package com.zheng.utils.base;

import com.alibaba.fastjson.JSON;
import com.google.common.base.CaseFormat;
import com.zheng.entity.NxYthBill;

import java.util.HashMap;
import java.util.Map;

/**
 * @ClassName ZhengUtil
 * @Description TODO
 * @Author zhengchenggong
 * @Date 2020/12/10 3:03 下午
 * @Version 1.0
 **/
public class ZhengUtil {

    public static <T> T mapUnderLineToHumpBean(Map<String, Object> map, Class<T> clazz) {

        Map newMap = new HashMap();
        for (String key : map.keySet()) {
            newMap.put(CaseFormat.LOWER_UNDERSCORE.to(CaseFormat.LOWER_CAMEL, key), map.get(key));
        }

        return JSON.parseObject(JSON.toJSONString(newMap), clazz);
    }

}
